package com.chey.service.impl;

import com.chey.dao.StlsDao;
import com.chey.pojo.META;
import com.chey.pojo.stls.DFLT;
import com.chey.pojo.stls.MSG22;
import com.chey.pojo.stls.STND;
import com.chey.service.StlsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * @author JanYao
 * @version 0.1
 */
@Service
public class StlsServiceImpl implements StlsService {
    @Autowired
    private StlsDao stlsDao;
    @Override
    public Integer insert(MSG22 msg) {

        String stls_uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();

        stlsDao.addMeta(stls_uuid,msg.getMeta());

        stlsDao.addDflt(stls_uuid,msg.getDFLT());

        List<STND> stnds= msg.getDFLT().getSTND();

        for (STND stnd : stnds) {

            stlsDao.addStnd(stls_uuid,stnd);
        }

        return null;
    }
}
